<meta charset="UTF-8">

<script type="text/javascript">
	$(function(){
		$("#dept_superior").combotree({
			width: 300,
			labelAlign: 'right',
			panelWidth: 210,
			url: 'dept/combotree',
			value:[[${model.dept==null?'null':model.dept.id}]],
			queryParams: {nodeId:[[${model.id==null?'null':model.id}]]},
			textField: 'name'
		});
		
		$('#dept_name').textbox({ 
			onChange: function(str){
				$.post('dept/name', {name: str}, function(data){
					if(data){
						$("#dept_resser").html("此班级或学院已添加！");
					}else{
						$("#dept_resser").html("");
					}
				});
			}
		});
	});
</script>

<form class="custom-form" action="dept/save" method="post">
	<input type="hidden" name="id" data-th-value="${model.id}">
	<p><input id = "dept_superior" name="parentId" data-options="label:'所属位置：'"></p>
	
	<p><input type="text" id="dept_name" class="easyui-textbox" name="name" data-th-value="${model.name}" 
	data-options="label:'名称：' ,labelAlign:'right',required:true"></p>
	<label class="resser" id = "dept_resser"></label>
	
	<p>
		<label style="margin-left: 25px;">负责人：</label>
		<select name="teacher" limitToList="true" required=true class="easyui-combobox" style="margin-left: 3px; width: 220px;">
			<option th:if="${name == null}" type="hidden"></option>
			<option th:if="${name != null}" th:value='${model.teacher.id}' th:text='${name}'></option>
			<option th:each="c:${teacher}" th:value="${c.id}" th:text="${c.name}"></option>
		</select>
	</p>
	
</form>
